package com.jie.model.mongo.base;

import com.jie.component.mongo.core.AbstractDocument;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@Document("user_visit_city")
@CompoundIndexes({
        @CompoundIndex(name = "idx_userId", def = "{'user_id': 1}")
})
public class UserVisitCityDocument extends AbstractDocument implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;


    @Field("user_id")
    private Long userId;
    
    @Field("visit_cities")
    private List<VisitCity> visitCities;
    
    @Data
    public static class VisitCity implements Serializable {
        @Serial
        private static final long serialVersionUID = 1L;

        @Field("city_id")
        private Long cityId;
        
        @Field("city_name")
        private String cityName;

        @Field("city_code")
        private String cityCode;
        
        @Field("visit_time")
        private Long visitTime;
    }
}